package top.yaofengqiao.springcloudsimple.tenant.starter.util;

/**
 * @author yfq
 * @date 2024/8/12 16:19
 * @description
 */
public class TenantContextHolder {
    private static final ThreadLocal<Long> TENANT_THREAD_LOCAL = new ThreadLocal<>();

    public static void setTenant(long tenant) {
        TENANT_THREAD_LOCAL.set(tenant);
    }

    public static long getTenant() {
        return TENANT_THREAD_LOCAL.get();
    }

    public static void clear() {
        TENANT_THREAD_LOCAL.remove();
    }
}
